<template>
  <div>
    <!-- 已完成 2018/3/7 11:44 zhangQ -->
    <Row style="margin-top: 15px;">
      <i-col span="24">
        <Table :columns="subOrderColumn" border :data="completeData" height="600"></Table>
      </i-col>
    </Row>
  </div>
</template>

<script>
  import { getTrainTypeCN } from './trainTypeEnum'

  export default {
    name: 'complete',
    data () {
      let subOrderColumn = [
        {
          type: 'index',
          width: 60
        },
        {
          title: '火车车种类型',
          ellipsis: 'false',
          width: 150,
          render: (h, params) => {
            let trainType = params.row.trainType
            let trainTypeCN = getTrainTypeCN(trainType)
            return (<span>{trainTypeCN}</span>)
          }
        },
        {
          title: '箱号',
          ellipsis: 'false',
          width: 150,
          key: 'containerNoBody',
          render: (h, params) => {
            let containerNo = params.row.containerNoHead + params.row.containerNoBody
            return (<span>{containerNo}</span>)
          }
        },
        {
          title: '司机',
          ellipsis: 'false',
          key: 'driverId',
          width: 200,
          render: (h, params) => {
            return (<span>{params.row.driverName}</span>)
          }
        },
        {
          title: '送货地址',
          ellipsis: 'false',
          width: 200,
          key: 'shippingAddress',
          render: (h, params) => {
            return (<span>{params.row.shippingAddress}</span>)
          }
        },
        {
          title: '联系人',
          ellipsis: 'false',
          width: 100,
          key: 'contacts'
        },
        {
          title: '联系人电话',
          ellipsis: 'false',
          width: 150,
          key: 'contactsMobile'
        },
        {
          title: '发货人',
          ellipsis: 'false',
          key: 'zkfhrmc',
          width: 250
        },
        {
          title: '收货人',
          ellipsis: 'false',
          key: 'zkshrmc',
          width: 250
        },
        {
          title: '品名',
          ellipsis: 'false',
          key: 'zkpmhz0',
          width: 150
        },
        {
          title: '接取送达费(元)',
          ellipsis: 'false',
          key: 'zkjf018',
          width: 120
        },
        {
          title: '状态',
          ellipsis: 'false',
          width: 80,
          render: (h, params) => {
            let driverId = params.row.driverId
            if (driverId) {
              return (<span style="color:green">已派单</span>)
            } else {
              return (<span style="color:red">未派单</span>)
            }
          }
        },
        {
          title: '操作',
          key: 'action',
          align: 'center',
          width: 250,
          render: (h, params) => {
            let voucherImg = params.row.voucherImg
            let viewImg = (<i-button size="small" style="margin-right: 5px;">图片查看</i-button>)
            if (voucherImg) {
              viewImg = (<i-button type="primary" size="small" style="margin-right: 5px;" onClick={() => this.viewDetailImgAction(params.row)}>图片查看</i-button>)
            }
            let btnArray = []
            powerUtil.contains('orderListUnfinishedFleet') && btnArray.push(viewImg)
            return (btnArray)
          }
        }
      ]
      let datas = { subOrderColumn }
      return datas
    },
    props: {
      completeData: {
        type: Array,
        default () {
          return []
        }
      },
      currentMainOrder: {
        type: Object,
        default () {
          return {}
        }
      }
    },
    computed: {},
    methods: {
      viewDetailImgAction (row) {
        this.$emit('viewDetailImg', row)
      }
    },
    created () {
    },
    mounted () {
    },
    components: {}
  }
</script>

<style scoped>

</style>
